package com.example.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.example.common.util.TreeNode;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName("sys_menu")
@EqualsAndHashCode(callSuper = false)
public class Menu implements TreeNode<Menu> {

    @TableId(type = IdType.AUTO)
    private Long id;

    private String title;

    private Long parentId;

    private Integer type;

    private String path;

    private String component;

    private String permission;

    private String icon;

    private Integer sort;

    private String visible;

    private String status;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @TableLogic
    private Integer deleted;

    @TableField(exist = false)
    private List<Menu> children;

    @Override
    public Long getId() {
        return this.id;
    }

    @Override
    public Long getParentId() {
        return this.parentId;
    }

    @Override
    public void setChildren(List<Menu> children) {
        this.children = children;
    }

    @Override
    public List<Menu> getChildren() {
        return this.children;
    }

    @Override
    public Integer getSort() {
        return this.sort;
    }
} 